package ducna.misscall.utils;

import android.util.Log;
import ducna.alozo.misscall.BuildConfig;

public class Logger {
	private static String TAG_MEMORY = "ALOZO-MEMORY";
	public static void i(String tag, String msg) {
		if (BuildConfig.DEBUG)
			Log.i(tag, msg);
	}

	public static void e(String tag, String msg) {
		if (BuildConfig.DEBUG)
			Log.e(tag, msg);
	}

	public static void v(String tag, String msg) {
		if (BuildConfig.DEBUG)
			Log.v(tag, msg);
	}

	public static void d(String tag, String msg) {
		if (BuildConfig.DEBUG)
			Log.d(tag, msg);
	}

	public static void out(String tag, String msg) {
		if (BuildConfig.DEBUG)
			System.out.println(tag + " : " + msg);
	}

	public static void printStackTrace(Exception e) {
		if (BuildConfig.DEBUG)
			e.printStackTrace();
	}

	public static void logMemory(String message) {
		if (!BuildConfig.DEBUG)
			return;
		Log.d(TAG_MEMORY, "======================================");
		Log.d(TAG_MEMORY, message);
		Log.d(TAG_MEMORY, "maxMemory: "+ Runtime.getRuntime().maxMemory());
		Log.d(TAG_MEMORY, "totalMemory: "+ Runtime.getRuntime().totalMemory());
		Log.d(TAG_MEMORY, "freeMemory: "+ Runtime.getRuntime().freeMemory());
		Log.d(TAG_MEMORY,"nativeHeapSize: " + android.os.Debug.getNativeHeapSize());
		Log.d(TAG_MEMORY, "nativeHeapAllocatedSize: " + android.os.Debug.getNativeHeapAllocatedSize());
		Log.d(TAG_MEMORY, "nativeHeapFreeSize: " + android.os.Debug.getNativeHeapFreeSize());
	}
}
